<%-- 
    Document   : take
    Created on : 5-dec-2009, 17:50:25
    Author     : Simon
--%>

<%@include file="../header.jsp" %>

<h1>Medication task</h1>
<c:if test="${!empty flash}">
    <div class="flash error">${flash}</div>
</c:if>

<c:choose>
    <c:when test="${task.prescription.dosageIsFixed}">

        <div>
            <span style="font-size:16pt;">
                <strong>Task instructions: </strong> you should take <span style="color:red">${task.prescription.dosageDosage} ${task.prescription.dosageUnit}</span> of ${task.prescription.medication.name}. <br /><br/>
            </span>
            <span style="font-size:12pt;">
                <a href="${pageContext.request.contextPath}/patient/task/complete?id=${task.id}">CONFIRM</a>
                <a href="${pageContext.request.contextPath}/patient">CANCEL</a>
            </span>
        </div>
    </c:when>
    <c:otherwise>
        <div>
            <span style="font-size:16pt;">
                <strong>Task instructions:</strong> <br/>
            </span>
            <br/>
            <p>This prescription has a variable dosage. You are required to take a measurement in order to decide the dosage of the medicine you should take.</p>
            <p>Please measure your <strong>${task.prescription.medication.measurementType}</strong> and fill it in or select one of your previous measurements:</p>
            <br/>
            <form method="post" action="${pageContext.request.contextPath}/patient/task/getdosage">
                <strong>${task.prescription.medication.measurementType}</strong> in ${unit}:
                <input type="text" name="measurementValue" size="2" />
                <input type="hidden" name="mId" value="${task.prescription.medication.id}" />
                <input type="hidden" name="taskId" value="${task.id}" />
                <c:if test="${!empty measurements}">
                    <select name="measurementId">
                        <option value="-1">--------</option>
                        <c:forEach var="m" items="${measurements}">
                            <option value="${m.id}">${m.measurementValue} ${m.unit}</option>
                        </c:forEach>
                    </select>
                </c:if>
                <input type="submit" name="submit" value="Decide dosage"/>
            </form>
        </div>
        <div class="back">
            <br />
            <a href="javascript:history.back()">Back</a>
        </div>
    </c:otherwise>
</c:choose>

<%@include file="../footer.jsp" %>
